<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class ProjectApply_model extends CI_Model {

    public $tablename = 'hpg_project_apply';
    
    public function getOneByUid($uid, $fields='*'){
        if( !$uid ){
            return false;
        }
        $list = $this->db->from($this->tablename)->select($fields)->where('uid', $uid)->get_array();
        $temp = [];
        foreach ($list as $v){
            $temp[$v['type']] = $v;
        }
        return $temp;
    }
    
    public function get( $map ){
        if( !$map ){
            return false;
        }
        $data = $this->db->from($this->tablename)->where($map)->fetchOne();
        return $data ? $data : [];
    }
    
    public function insert( $data ){
        if( !$data ){
            return false;
        }
        $res = $this->db->insert($this->tablename, $data);
        return $this->db->insert_id();
    }
}    
?>